package com.kkom1.tapeat;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import data_management.PatternDataManager;

public class NickSettingActivity extends Activity {
	private PatternDataManager pdata = PatternDataManager.getInstance();
	private EditText et;
	private Button bt_submit;
	private void initView(){
		et = (EditText)findViewById(R.id.nick_ed_text);
		et.setText(""+et.getText() + pdata.getList().size());
		bt_submit = (Button)findViewById(R.id.bt_submit);
		bt_submit.setOnClickListener(new SubmitEvent());
	}
	
	class SubmitEvent implements View.OnClickListener{
		public void onClick(View v) {
			String patternNick = et.getText().toString();
			if(patternNick.equals("")){
				Toast.makeText(NickSettingActivity.this, R.string.msg_ask_TypePatternNick, 0).show();
				return ;
			}
			pdata.setPatternNick(patternNick);
			Intent next = new Intent(NickSettingActivity.this, SelectActivity.class);
			NickSettingActivity.this.startActivity(next);
			NickSettingActivity.this.finish();
		}
	}
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_nick_setting);
		initView();
	}

}
